package com.taritari.journal.controller;

import com.taritari.journal.entity.po.TestPo;
import com.taritari.journal.entity.po.WordCloudAnalyse;
import com.taritari.journal.services.WordCloudAnalyseService;
import com.taritari.journal.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author taritari
 * @date 2024-05-11 19:52
 * @description
 */
@RestController
@Slf4j
@Tag(name = "词云类", description = "词云类")
@RequestMapping("/wordCloud")
public class WordCloudAnalyseController {
    @Autowired
    private WordCloudAnalyseService wordCloudAnalyseService;
    @GetMapping("/getAnalyse")
    @Operation(summary = "获取分析报告", description = "获取分析报告")
    public Result getAnalyse(@RequestParam Integer authorId) {
        WordCloudAnalyse analyse = wordCloudAnalyseService.getAnalyse(authorId);
        return Result.success(analyse);
    }

    @GetMapping("/sendEmailAsToDay")
    @Operation(summary = "发送今天的分析报告", description = "发送今天的分析报告")
    public Result sendEmailAsToDay(@RequestParam Integer authorId) {
        Result result = wordCloudAnalyseService.sendWordCloudEmail(authorId);
        return result;
    }
}
